<div class="row">
    <div class="col-lg-12">
        <section class="panel">
            <header class="panel-heading">
                個人設定
            </header>
            <div class="panel-body">
                <form id="form" class="form-horizontal tasi-form" method="get">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">賬號</label>
                        <div class="col-sm-10">
                            <input name="Name" type="text" class="form-control" value="{$UserData['Name']}" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input name="Nick" type="text" class="form-control" value="{$UserData['Nick']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">性別</label>
                        <div class="col-sm-10">
                            <select name="Sex" class="form-control m-bot15">
                                <?php
                                for($i=0; $i<3; $i++){
                                    $OptionName = '請選擇';
                                    if($i == 1) $OptionName='男';
                                    else if($i == 2) $OptionName='女';
                                    $OptionStatus = '';
                                    if($i==$UserData['Sex']){
                                        $OptionStatus = 'selected';
                                    }
                                    echo "<option value='$i' $OptionStatus > $OptionName </option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">微信</label>
                        <div class="col-sm-10">
                            <input name="WeChat" type="text" class="form-control" value="{$UserData['WeChat']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">QQ</label>
                        <div class="col-sm-10">
                            <input name="QQ" type="text" class="form-control" value="{$UserData['QQ']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">電話</label>
                        <div class="col-sm-10">
                            <input name="Phone" type="tel" class="form-control" value="{$UserData['Phone']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">電郵</label>
                        <div class="col-sm-10">
                            <input name="Email" type="email" class="form-control" value="{$UserData['Email']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-10">
                            <button class="btn btn-primary" lay-submit lay-filter="formSubmit">立即提交</button>
                            <button type="reset" class="btn btn-info">重置</button>
                        </div>
                    </div>

                </form>
            </div>
        </section>
    </div>
</div>

<script>
    layui.use('form', function () {
        var form = layui.form;
        document.getElementById("form").classList.add('layui-form');
        form.on('submit(formSubmit)', function (data) {
            var fields = data.field;
            global.log('系統設定 - 提交數據', fields);
            global.post('/index.php/superadmin/Setting/mb_SubmitUserSetting', fields, function (msg) {
                if (msg['code'] == ErrCode_Normal) {
                    layer.msg(msg['msg'], {
                        offset: '15px'
                        , icon: 1
                        , time: 1000
                    }, function () {
                        window.location.reload();
                    });
                } else mb_OnMessage(msg);
            });
            return false;
        });
    });
</script>